# Provide file names and this will list the G and M codes used in the file.
# in Windows, if you add the appropriate reg entry, you can just drop files
# onto this script and it should do it for you

import sys
codes = []

for file in sys.argv[1:]:
    f = open (file)
    lines = f.readlines()
    f.close()
    
    for line in lines:
        parameters = line.split()
        for p in parameters:
            if p.startswith("G") or p.startswith("M"):
                codes.append(p)


print set(codes)

raw_input("Press to end")
